<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>创建考试</title>
<link rel="stylesheet" href="../static/layui/css/layui.css">
<style>    
  .layui-body{ padding: 10px}
</style>
</head>
<body>
    </br>
	<h2>创建考试</h2></br>
	
	<!-- 按钮区 -->
	<div class="site-demo-button" id="layerDemo" style="margin-bottom: 0;">
	  <button class="layui-btn">创建考试</button>
	  <button class="layui-btn">考试管理</button>
	</div></br>
	
	<!-- 主体内容区 lay-verify="required"必填项  -->
	<form class="layui-form" action="exam_record?m=add" method="post">
	  <!-- 考试名 -->
	  <div class="layui-form-item">
	    <label class="layui-form-label">考试名称</label>
	    <div class="layui-input-block">
	      <input type="text" name="record" required  lay-verify="required" placeholder="考试名称" autocomplete="off" class="layui-input">
	    </div>
	  </div>
	  
	  <!-- 试卷 -->
	  <div class="layui-form-item">
	    <label class="layui-form-label">试卷</label>
	    <div class="layui-input-block">
	      <select name="exam" lay-verify="required">
	        <option value="">选择试卷</option>
	        <c:forEach items="${examlist}" var="cls">
	        <c:if test="${cls.exam_name!=null}">
	        <option value="${cls.exam_id}">${cls.exam_name}</option>
	        </c:if>
	        </c:forEach>
	      </select>
        </div>
      </div>
	  
	  <!-- 考试开始时间 -->
	  <div class="layui-form-item">
	    <div class="layui-inline">
	      <label class="layui-form-label">开考时间</label>
	      <div class="layui-input-inline">
	        <input type="text" name="start" class="layui-input" id="test1" placeholder="设置时间">
	      </div>
	    </div>
	  </div>
	  
	  <!-- 考试结束时间 -->
	  <div class="layui-form-item">
	    <div class="layui-inline">
	      <label class="layui-form-label">结束时间</label>
	      <div class="layui-input-inline">
	        <input type="text" name="end" class="layui-input" id="test1" placeholder="设置时间">
	      </div>
	    </div>
	  </div>
	  
	  <!-- 及格分数 -->
	  <div class="layui-form-item">
	    <label class="layui-form-label">及格分数</label>
	    <div class="layui-input-block">
	      <input type="text" name="score" required  lay-verify="required" placeholder="及格分数" autocomplete="off" class="layui-input">
	    </div>
	  </div>
	  
	  <!-- 提交 -->
	  <div class="layui-form-item">
	    <div class="layui-input-block">
	      <button type="submit" class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
	      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
	    </div>
	  </div>
</form>
 
</body>
<script type="text/javascript" src="../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../static/layui/layui.js"></script>
<script>
//考试时间
layui.use('laydate', function(){
  var laydate = layui.laydate;
  
  //常规用法
  laydate.render({
    elem: '#test1'
    ,type: 'datetime'
  });
});
//提交监听
layui.use('form', function(){
	  var form = layui.form;
	  
	  //监听提交
	  form.on('submit(formDemo)', function(){
	    layer.msg('注册成功，点击最后一页可查看');
	    return true;
	  });
});
//按钮切换
$(function(){
    $("button:eq(0)").click(function(){
    	window.location.href='http://localhost:8080/OnlineExam1/admin/exam_record?m=addExam'
    });

    $("button:eq(1)").click(function(){
    	window.location.href='http://localhost:8080/OnlineExam1/admin/exam_record?m=page'
    }); 
});
</script>
</html>